<template>
  <div class="person"></div>
  <p>Age: {{ age }}</p>
  <p>Occupation: {{ occupation }}</p>
  <button @click="showname">查看姓名</button>
  <button @click="changename">修改名字</button>
</template>

<style scoped>
button {
  margin: 5px;
  padding: 5px 10px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
</style>
<script lang="ts">
export default {
  name: 'Person_1',
  data() {
    return {
      name: 'John Doe',
      age: 30,
      occupation: 'Software Developer',
    }
  },
  methods: {
    changename() {
      this.name = 'zhang_san'
    },
    showname() {
      alert(this.name)
    },
  },
}
</script>
